import * as bm from "/js/baseModule.js";

export class Module extends bm.baseModule {
    constructor(view) {
        super(view);
        let that = this;
        let vueDom = this.find("#UserCenter_vue").get(0);
        let user = this.user = globalData.user;
        let UserCenter_vue = this.UserCenter_vue = new Vue({
            el: vueDom,
            data: {
                user: user,
                openService: false,
                pack: globalData.pack
            },
            watch: {
                'user.phone': "checkInfo",
                code: "checkInfo",
            },
            computed: {
                expired: function () {
                    if (this.pack.id == 0) {
                        return true
                    }
                    let now = new Date().getTime();
                    let endDate = new Date(this.pack.end_date).getTime();
                    let dayTransMs = 1000 * 60 * 60 * 24;//上一行代码得出的结果是截止日期当天的0点0分，所以需要在此基础上加24小时；
                    return now > endDate + dayTransMs
                },
            },
            methods: {
                /**编辑个人信息 */
                userInfo: function () {
                    location.hash = 'user/UserInfo?uid='+globalData.user.user_id;
                },
                /**开通增值服务 */
                valueAddService: function () {
                    location.hash = 'pack/MyPack';
                },
                /**了解我们 */
                aboutUs: function () {
                    location.hash = 'AboutForm';
                },
                /**业务范围 */
                setService: function () {
                    location.hash = 'user/SetService';
                },
                /**会员等级 */
                vipLevel: function () {
                    location.hash = 'user/VipLevel';
                }
            }
        });
    }
    afterUninstall(){
        funs.getModuleFuns('modules/common/NewFooter.js',function (mod) {
            mod.backIndex();
        })
    }
    
}
